home *** CD-ROM | disk | FTP | other *** search
Java Source | 2000-09-08 | 1.5 KB | 66 lines |
-
-
- package applets;
-
- import shout3d.*;
- import java.awt.*;
-
-
- public class MultiViewpointsGUIApplet extends Shout3DApplet {
-
- int total = 1;
- Button newcam;
- Choice list;
- Panel bottomPanel;
-
-
- public void initShout3DPanel(){
- panel = new MultiViewpointsGUIPanel(this, 320, 210);
-
- setLayout(new BorderLayout());
- newcam = new Button("NEW CAMERA");
- list = new Choice();
- list.addItem("Camera "+ total);
- bottomPanel = new Panel();
- bottomPanel.add(newcam);
- bottomPanel.add(list);
- add(bottomPanel, "South");
- }
-
-
- public boolean action(Event e, Object o) {
-
- //user pressed button;
- //calls createCamera() in panel class
- if (e.target == newcam) {
-
- MultiViewpointsGUIPanel pnl = (MultiViewpointsGUIPanel) panel;
- pnl.createCamera();
- total = pnl.totalCams;
- list.addItem("Camera "+ total);
-
- //call select to update list
- list.select(total - 1);
-
- //disable button, if necessary
- if(total == 3) {newcam.enable(false);}
- return true;
- }
-
- //user selects from list
- if (e.target == list) {
-
- int i = list.getSelectedIndex();
- MultiViewpointsGUIPanel pnl = (MultiViewpointsGUIPanel) panel;
- pnl.currentCam = i + 1;
- pnl.cameras[i].isBound.setValue(true);
- return true;
- }
-
- return false;
-
- }//end of action method
-
-
-
- }//end of class